<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-系统管理">
</@frame.head>
<div class="page-container">
	<form action="${contextPath}/helpCategory/helpCategory_update" method="post" class="form form-horizontal" id="form-helpCategory">
	<input type="hidden"  name="id" id="id" value="${(helpCategory.id)}"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				帮助分类名称：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<input type="text" class="input-text" value="${helpCategory.name}" placeholder="" id="name" name="name" >
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				显示顺序：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<input type="text" class="input-text" value="${helpCategory.position}" placeholder="" id="position" name="position" >
			</div>
		</div>

		<div class="row cl">
			<div class="col-9 col-offset-2">
				<input class="btn btn-primary radius" type="button" onclick="update();"  value="&nbsp;&nbsp;修改&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
<@frame.end "default">
</@frame.end>
<script type="text/javascript" src="${contextPath}/resources/lib/zTree/v3/js/jquery.ztree.core-3.5.min.js"></script>
<script type="text/javascript" src="${contextPath}/resources/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
var path="${contextPath}";
 //正数验证
function checkNum(e){
	var parm=e;
	var vArr = parm.match(/^[0-9]+$/);
	if(vArr==null){
		return false;
	}else{
		return true;
	}
}
function update(){
	var name=$("#name").val();
    var position=$("#position").val(); 
	//验证只包含字母或者汉字
var pattern1 =/(^[\u4e00-\u9fa5A-Za-z]*$)/;

	   if(name.length==0){
		   layer.alert("请输入名称");
          document.typeForm.name.focus();
          return false;
       }
	 if (!pattern1.test(name)) {
		 layer.alert("请输入合法的名称！");
	     	   document.typeForm.name.focus();
	       	   return false;
  	   }
  	   
       if(position.length==0){
    	   layer.alert("请输入显示顺序");
          document.typeForm.age.focus();
          return false;
       }

       if(!checkNum(position)){
    	   layer.alert("显示顺序为正整数！");
	      document.typeForm.age.focus();
	      return false;
	   }
    $("#form-helpCategory").ajaxSubmit({
		dataType : 'html',
        success: function(message){
        		if(message == "200"){
                    layer.msg('操作成功!',{icon:1,time:1000},function(){
/*                         var index = parent.layer.getFrameIndex(window.name);
                        parent.query_brand_form.submit();
                        parent.layer.close(index); */
                        parent.window.location.reload();
                    });
 				}else if(message == "500"){
 					layer.alert("系统繁忙！");
 				}else{
 					layer.alert(message);
 				}
        },
        error: function(){
            layer.msg('操作失败!',{icon:5,time:1000});
        }
    });
}

</script>
</body>
</html>